package cn.yr.blog.service.impl;

import cn.yr.blog.mapper.AccessLogMapper;
import cn.yr.blog.mapper.ArticleMapper;
import cn.yr.blog.mapper.TagMapper;
import cn.yr.blog.service.CountService;
import cn.yr.common.core.domain.vo.CountVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @Title: CountServiceImpl
* @Description: 统计
* @author Lang
* @date 2020/3/29 17:23
*/
@Service
public class CountServiceImpl implements CountService {

	@Resource
	private ArticleMapper articleMapper;
	@Resource
	private TagMapper tagMapper;
	@Resource
	private AccessLogMapper accessLogMapper;

	@Override
	public CountVo getCount() {
		CountVo countVo = new CountVo();
		Integer articleSum = articleMapper.selectCount(null);
		countVo.setArticleSum(articleSum);
		Integer tagSum = tagMapper.selectCount(null);
		countVo.setTagSum(tagSum);
		Integer accessLogSum = accessLogMapper.selectCount(null);
		countVo.setAccessSum(accessLogSum);
		return countVo;
	}
}
